package com.example.villagedevelop.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.villagedevelop.generator.entity.ImageCase;
import com.example.villagedevelop.generator.mapper.ImageCaseMapper;
import com.example.villagedevelop.generator.service.ImageCaseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author villagedevelop
 * @since 2021-11-13
 */
@Service
public class ImageCaseServiceImpl extends ServiceImpl<ImageCaseMapper, ImageCase> implements ImageCaseService {
    @Autowired
    ImageCaseMapper mapper;

    @Override
    public List<String> getImagesByCid(Integer cid) {
        List<String> imagess = new ArrayList<>();
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("c_id",cid);
        List<ImageCase> images= mapper.selectList(wrapper);
        for (ImageCase image : images){
            imagess.add(image.getImageFile());
        }
        return imagess;
    }
}
